{% load static %}
<html>
<head lang="en">
    <title>股票热度信息</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="{% static '/css/jquery-ui.css' %}">
    <link href="{% static '/css/bootstrap.min.css' %}" rel="stylesheet" media="screen">
    <link href="{% static '/css/bootstrap-datetimepicker.min.css' %}" rel="stylesheet" media="screen">
    <script src="{% static '/js/jquery-1.12.4.js' %}"></script>
    <script src="{% static '/js/jquery-ui.js' %}"></script>
    <script type="text/javascript" src="{% static '/js/jquery-1.8.3.min.js' %}" charset="UTF-8"></script>
    <script type="text/javascript" src="{% static '/js/bootstrap.min.js' %}"></script>
    <script type="text/javascript" src="{% static '/js/bootstrap-datetimepicker.js' %}" charset="UTF-8"></script>
    <script type="text/javascript" src="{% static '/js/bootstrap-datetimepicker.zh-CN.js' %}" charset=
            "UTF-8"></script>
</head>
<body>
<div id="FP_chart" style="height: 88.5714%;width: 100.0%;">
    <canvas id="canvas_layer" width="30000" height="900" style="border: 1px solid #eeeeee;"></canvas>
    <div>
        <div id="indicator"
             style="position: absolute; z-index: 51; border-style: dashed; border-color: rgb(73, 73, 73);left : 10px; top: 20px; border-width: 0px 1px 0px 0px; height: 665px;"/>
    </div>
    <div>
        <div id="float_window"
             style="position: absolute; z-index: 52; padding: 2px; width: 180px; line-height: 16px; font-size: 12px; left: 60px; top: 30px; background-color: rgba(255, 255, 255, 0.9); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);">
            <table style="border: 0px; font: inherit; vertical-align: baseline; margin: 0px; padding: 0px; border-collapse: collapse; border-spacing: 0px; text-align: center; width: 100%;">
                <thead>
                <tr>
                    <th colspan="2" style="font-weight: normal; border: 0px; height: 16px; text-align: center;">
                        <span>市场温度</span>
                    </th>
                </tr>
                </thead>
                <tbody id="tbodys">
                <tr style="text-align: center;">
                    <th colspan="2" style="font-weight: normal; border: 0px; height: 16px; text-align: center;">
                        <span id="date">2019/08/21/三</span>
                    </th>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>昨日曾涨停今日收益率</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="ceng_ratio">4.78%</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>昨日涨停今日收益率</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="ting_ratio">4.82%</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>高标</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="gaobiao">0天</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>盘中超跌家数</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="chaodie">0家</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>今日跌停家数</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="dieting">0家</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>今日曾涨停家数</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="cengting">0家</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>今日涨停家数</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="zhangting">0家</span>
                    </td>
                </tr>
                <tr>
                    <th style="text-align: left; font-weight: normal; border: 0px; height: 16px;">
                        <span>封板率</span>
                    </th>
                    <td style="text-align: right; border: 0px; height: 16px;">
                        <span id="closure_plate">0%</span>
                    </td>
                </tr>

                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="container">
    <label class="labe_l">开始日期:</label>
    <div class="clearfix tex_t reset_text">
        <div class="input-append date fl" style="float:left" id="datetimeStart">
            <input type="text" class="">
            <span class="add-on"><i class="icon-th"></i></span>
        </div>
        <span class="to_link">至</span>
        <div class="input-append date fl" style="float:left" id="datetimeEnd">
            <input type="text" class="">
            <span class="add-on"><i class="icon-th"></i></span>
        </div>
        <input type="number" value="300" id="size_1">
        <input type="button" value="提交" id="submit_btn"/>
    </div>
</div>

<script>
    //日期插件初始化
    var nw = new Date();
    nw.setDate(nw.getDate()-300)
    $('#datetimeStart').datetimepicker({
        language: 'zh-CN',
        format: 'yyyy-mm-dd',
        weekStart: 1,
        /*以星期一为一星期开始*/
        todayBtn: 1,
        autoclose: 1,
        minView: 2,
        initialDate: nw,
        /*精确到天*/
        pickerPosition: "bottom-left"
    }).on("changeDate", function (ev) { //值改变事件
        //选择的日期不能大于第二个日期控件的日期
        if (ev.date) {
            $("#datetimeEnd").datetimepicker('setStartDate', new Date(ev.date.valueOf()));
        } else {
            $("#datetimeEnd").datetimepicker('setStartDate', null);
        }
        console.log(($("#datetimeStart").datetimepicker().val()))
    });
    $('#datetimeEnd').datetimepicker({
        language: 'zh-CN',
        format: 'yyyy-mm-dd',
        weekStart: 1,
        /*以星期一为一星期开始*/
        todayBtn: 1,
        autoclose: 1,
        minView: 2,
        /*精确到天*/
        pickerPosition: "bottom-left"
    }).on("changeDate", function (ev) {
        //选择的日期不能小于第一个日期控件的日期
        if (ev.date) {
            $("#datetimeStart").datetimepicker('setEndDate', new Date(ev.date.valueOf()));
        } else {
            $("#datetimeStart").datetimepicker('setEndDate', new Date());
        }
    });
    //设置默认时间
    $("#datetimeEnd").datetimepicker('setStartDate', new Date());
</script>

</body>
</html>
<script type="application/json" src="cengzhang_earning.json"></script>
<script>
    var LChart = function () {
        this.con = document.querySelector("canvas").getContext("2d");
        this.canW = this.con.canvas.width;
        this.canH = this.con.canvas.height;
        this.size = 10;
        this.space = 20;
        this.step = 20;
        this.x0 = this.space;
        this.dateheight = 100;
        this.y0 = this.canH - this.space - this.dateheight;
        this.pointSize = 4;
        this.tbodys = document.getElementById('tbodys');
        this.date = document.getElementById('date');
        this.ceng_ratio = document.getElementById('ceng_ratio');
        this.ting_ratio = document.getElementById('ting_ratio');
        this.gaobiao = document.getElementById('gaobiao');
        this.chaodie = document.getElementById('chaodie');
        this.dieting = document.getElementById('dieting');
        this.cengting = document.getElementById('cengting');
        this.zhangting = document.getElementById('zhangting');
        this.indicator = document.getElementById('indicator');
        this.float_window = document.getElementById('float_window');
        this.closure_plate_htm = document.getElementById("closure_plate");
        this.gaobiao_scale = 40;

    };

    LChart.prototype.check_load_data = function () {

        lc.init();
        lc.monitorMouse();
    };

    LChart.prototype.transform_function_1 = function (data, object) {
        return data * 10 + 100 - 2 * object.gaobiao_scale;
    };
    LChart.prototype.func = function (data) {
        return data
    };
    LChart.prototype.transform_function_2 = function (data) {
        var thp = LChart.prototype;
        return data * thp.die_ting_reform_base * thp.max_y_height_die;
    };

    LChart.prototype.transform_function_3 = function (data) {
        var thp = LChart.prototype;
        return thp.func(data) * thp.zhangting_reform_base * thp.max_y_height;
    };
    LChart.prototype.rewrite_arg = function () {
        var thp = LChart.prototype;
        thp.zhangting_reform_base = 1 / thp.func(Math.max.apply(null, cengzhang_list));
        thp.die_ting_reform_base = 1 / Math.max.apply(null, diechao_5);
        thp.max_y_height = 220;
		thp.max_y_height_die = 220
    };

    LChart.prototype.init = function () {
        //清楚画布
        this.con.clearRect(0, 0, 20000, 1000);

        // this.huaGeZi();
        this.drawdate(date_list_a);
        // 涨停收益率的曲线信息
        this.broken_line(cengzhang_earning_data, this.transform_function_1, "#66b2ff", true, "#66b2ff");
        this.broken_line(zhangting_earning_data, this.transform_function_1, "red", true, "red");

        // rewrite_arg()
        this.rewrite_arg();
        this.rectMatrix(gaobiao_data, this.gaobiao_scale);
        this.fillpoint(cengzhang_list, "black", this.x0, 370, this.transform_function_3, true);
        this.fillpoint(zhangting_list, "red", this.x0, 370, this.transform_function_3, true);
        this.fillpoint(diechao_5, "green", this.x0, 10, this.transform_function_2, false);
        this.fillpoint(dieting_list, "black", this.x0, 10, this.transform_function_2, false);
        LINE_X_SHIFT = 30;
        // 涨停的线 需要进行reverse
        drawerLowBaseY = 370;
        this.drawline(this.x0 + LINE_X_SHIFT, drawerLowBaseY - this.transform_function_3(zhangting_line), this.x0 +
            LINE_X_SHIFT * dieting_list.length,
            drawerLowBaseY - this.transform_function_3(zhangting_line), "#66b2ff");
        this.drawline(this.x0 + LINE_X_SHIFT, drawerLowBaseY, this.x0 + 300,
            drawerLowBaseY, "black");

        // 跌停的线
        this.drawline(this.x0 + LINE_X_SHIFT, 10 + this.transform_function_2(dieting_line), this.x0 + LINE_X_SHIFT *
            dieting_list.length, 10 +
            this.transform_function_2(
                dieting_line), "blue");

        // 最下方的收益率线条
        this.drawline(this.x0 + LINE_X_SHIFT, this.y0 - (shouyi_ratio_line) * this.gaobiao_scale, this.x0 +
            LINE_X_SHIFT * dieting_list.length,
            this.y0 - (shouyi_ratio_line) * this.gaobiao_scale, "black");
        // 日期上方写出封板率
        this.drawFBL(closure_plate)
    };
    LChart.prototype.huaGeZi = function () {
        var lineX = Math.floor(this.canH / this.size);
        for (var i = 1; i < lineX; i++) {
            this.con.beginPath();
            this.con.strokeStyle = "#eee";
            this.con.moveTo(0, i * this.size + 0.5);
            this.con.lineTo(this.canW, i * this.size + 0.5);
            this.con.stroke();
        }
        var lineY = Math.floor(this.canW / this.size);
        for (var j = 1; j < lineY; j++) {
            this.con.beginPath();
            this.con.strokeStyle = "#eee";
            this.con.moveTo(j * this.size + 0.5, 0);
            this.con.lineTo(j * this.size + 0.5, this.canH);
            this.con.stroke();
        }
    };

    LChart.prototype.drawline = function (startX, startY, endX, endY, color) {
        this.con.beginPath();
        //X
        this.con.moveTo(startX, startY);
        this.con.lineTo(endX, endY);
        this.con.strokeStyle = color;

        this.con.stroke();
    };

    LChart.prototype.zb = function () {
        this.con.beginPath();
        //X
        this.con.moveTo(this.x0, this.y0);
        this.con.lineTo(this.canW - this.space, this.y0);
        this.con.lineTo(this.canW - this.space - this.size, this.y0 + this.size / 2);
        this.con.lineTo(this.canW - this.space - this.size, this.y0 - this.size / 2);
        this.con.lineTo(this.canW - this.space, this.y0);
        this.con.fill();
        this.con.strokeStyle = "gray";
        this.con.stroke();
        //Y
        this.con.moveTo(this.x0, this.y0);
        this.con.lineTo(this.x0, this.space);
        this.con.lineTo(this.x0 + this.size / 2, this.space + this.size);
        this.con.lineTo(this.x0 - this.size / 2, this.space + this.size);
        this.con.lineTo(this.x0, this.space);
        this.con.fill();
        this.con.strokeStyle = "gray";
        this.con.stroke();
    };

    LChart.prototype.broken_line = function (data, transform_function, color, need_font, font_color) { //绘制折线函数
        this.con.beginPath();
        var that = this;
        var prevX = 0;
        var prevY = 0;
        that.con.strokeStyle = color;
        for (var i = 0; i < data.length; i++) {
            var canvasX = that.x0 + (i + 1) * this.step;
            var canvasY = that.y0 - transform_function(data[i], this) - 40;
            if (need_font === true) {
                that.drawFont({
                    "text": data[i],
                    "x": canvasX + 10,
                    "y": canvasY,
                    "color": font_color
                })
            }
            that.con.fillRect(canvasX - that.pointSize / 2, canvasY - that.pointSize / 2, that.pointSize, that.pointSize);
            if (i == 0) {
                that.con.moveTo(canvasX, canvasY);
            } else {
                that.con.moveTo(prevX, prevY);
                that.con.lineTo(canvasX, canvasY);
                that.con.stroke();
            }
            prevX = canvasX;
            prevY = canvasY;
        }
    };

    LChart.prototype.fillpoint = function (data, color, startX, startY, transform_function, reverse) {
        var that = this;
        var prevX = startX;
        var prevY = startY;
        that.con.beginPath();
        that.con.strokeStyle = color;
        that.con.fillStyle = color;
        var startx = 0;
        var starty = 0;
        for (var i = 0; i < data.length; i++) { //绘制柱形
            var canvasX = startX + (i + 1) * this.step;
            var offsetY = data[i];
            if (transform_function != null) {
                offsetY = transform_function(data[i]);
            }
            var canvasY = reverse ? startY - offsetY : startY + offsetY;
            if (i == 0) {
                startx = canvasX;
                starty = startY;
                that.con.moveTo(canvasX, canvasY);
            } else {
                that.con.lineTo(canvasX, canvasY);
            }
            prevX = canvasX;
            prevY = canvasY;
        }
        that.con.lineTo(prevX, startY);
        that.con.lineTo(startx, starty);
        //that.con.closePath();
        that.con.fill();
        this.con.restore();
    };


    LChart.prototype.drawRoundRect = function (x, y, width, height, radius) {
        this.con.beginPath();
        this.con.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2);
        this.con.lineTo(width - radius + x, y);
        this.con.arc(width - radius + x, radius + y, radius, Math.PI * 3 / 2, Math.PI * 2);
        this.con.lineTo(width + x, height + y - radius);
        this.con.arc(width - radius + x, height - radius + y, radius, 0, Math.PI * 1 / 2);
        this.con.lineTo(radius + x, height + y);
        this.con.arc(radius + x, height - radius + y, radius, Math.PI * 1 / 2, Math.PI);
        this.con.closePath();
    };


    LChart.prototype.drawFont = function (options, vertical) {
        this.con.save();
        this.con.fillStyle = options.color;
        this.con.font = this.w * options.fontSizePercent + "px 宋体";
        this.con.textAlign = options.textAlign || "center";
        this.con.textBaseline = options.textBaseline || "bottom";
        if (vertical) {
            this.con.rotate(-45 * Math.PI / 180);
        }
        this.con.fillText(options.text, options.x, options.y);

        this.con.restore();
    };


    LChart.prototype.rectMatrix = function (data, amplify) {
        var hArrTop = 12; //直方图，柱形上方显示字体
        var pos = 100; //起始位置

        var lineWPercent = 0.25; //柱形宽度
        var rectRadiusPercent = 1 / 2; //柱形圆角大小
        var strokeStyle = "gray"; //柱形颜色
        var topFontColor = "gray"; //柱形顶部文字颜色
        var topFontSizePercent = 1 / 25; //柱形顶部文字大小
        var isShadow = false;

        var num = data.length; //直方图，柱形个数

        var lineW = 6; //柱形宽度
        var y = this.y0; //柱形底部位置

        if (isShadow) {
            this.con.save();
            this.con.shadowOffsetX = 5; //绘制阴影
            this.con.shadowOffsetY = 5;
            this.con.shadowBlur = 4;
            this.con.shadowColor = "rgba(0, 0, 0, 0.2)";
        }

        this.con.fillStyle = "rgba(0, 0, 0,0.3)"; //填充柱形,颜色
        for (var i = 0; i < num; i++) { //绘制柱形
            var x = this.x0 + this.step * (i + 1);
            this.drawRoundRect(x - lineW / 2, this.y0 - data[i] * amplify, lineW, data[i] * amplify, lineW * rectRadiusPercent);
            this.con.fill();
            if (true) {
                this.drawFont({
                    x: x,
                    y: y - data[i] * amplify - 10,
                    text: data[i],
                    color: topFontColor,
                    fontSizePercent: topFontSizePercent
                }, false);
            } //绘制文字
        }
        this.con.restore();
    };

    //绘制日期
    LChart.prototype.drawdate = function (data) {
        var num = data.length; //个数

        var lineW = 6; //柱形宽度
        var y = this.y0; //柱形底部位置

        this.con.fillStyle = "rgba(0, 0, 0, 0.8)"; //填充柱形,颜色
        for (var i = 0; i < num; i++) { //绘制字体
            var x = this.y0 + this.step * 0.7071 * (i + 2);
            this.drawFont({
                x: this.y0 + this.step * 0.7071 * i - this.canH * 1.414 - 2 * this.step * this.canH / 200 + 105,
                y: x - 2 * this.step * this.canH / 200 -10,
                text: data[i],
                color: "rgba(0, 0, 0, 0.8)",
                fontSizePercent: 1 / 25
            }, true);
        }
        this.con.restore();
    };

    LChart.prototype.drawFBL = function (data) {
        var num = data.length; //个数

        var lineW = 6; //柱形宽度
        var y = this.y0; //柱形底部位置

        for (var i = 0; i < num; i++) { //绘制字体
            var x = this.y0 + this.step * 0.7071 * (i + 2);
            this.drawFont({
                x: this.y0 + this.step * 0.7071 * i - this.canH * 1.414 - 2 * this.step * this.canH / 200 + 135,
                y: x - 2 * this.step * this.canH / 200 - 30,
                text: data[i],
                color: "#804000",
                fontSizePercent: 1 / 25
            }, true);
        }
        this.con.restore();
    };
    LChart.prototype.drawGaoBiaoCode = function (highLevelCodes) {
        var that = this;
        var childs = that.tbodys.childNodes;
        var BASE_NUM_SIZE = 19 - 1;
        var len = childs.length - 1;

        while (len > BASE_NUM_SIZE && len >= 0) {
            that.tbodys.removeChild(childs.item(len));
            len--
        }
        // 高标的开头
        var gb_head = document.createElement("tr");
        gb_head.innerHTML =
            '<th colspan="2" style="font-weight: normal; border: 0px; height: 16px; text-align: center;"><span>高标股票信息</span></th>';

        // 添加新的高标股票信息
        that.tbodys.appendChild(gb_head);

        for (var idx in highLevelCodes) {
            hlc = highLevelCodes[idx];
            st = '<th style="text-align: left; font-weight: normal; border: 0px; height: 16px;"><span>' + hlc['code'] + ' ' +
                hlc['name'] + '</span></th><td style="text-align: right; border: 0px; height: 16px;"><span id="gaobiao">' + hlc[
                    'limit_count'] + '天</span></td>';
            var n_tr = document.createElement("tr");
            n_tr.innerHTML = st;
            that.tbodys.appendChild(n_tr)
        }

    };
    LChart.prototype.updateFloatText = function (ev) {
        var index = 0;
        if (ev.layerX <= this.x0 + this.step + this.step / 2) {
            index = 0;
        } else if (ev.layerX > this.x0 + (date_list_a.length - 1) * this.step + this.step / 2) {
            index = parseInt(date_list_a.length - 1);
        } else {
            index = parseInt((ev.layerX - this.step - this.step / 2) / this.step);
        }

        this.indicator.style = "position: absolute; z-index: 51; border-style: dashed; border-color: rgb(73, 73, 73);left: " +
            (((index + 1) * this.step + 0 + this.x0) + "") +
            "px; top: 20px; border-width: 0px 1px 0px 0px; height: " + ((this.canH - 135) + "") + "px;";

        this.date.innerHTML = date_list_a[index];
        this.ceng_ratio.innerHTML = cengzhang_earning_data[index] + "%";
        this.ting_ratio.innerHTML = zhangting_earning_data[index] + "%";
        this.gaobiao.innerHTML = gaobiao_data[index] + "天";
        this.chaodie.innerHTML = diechao_5[index] + "家";
        this.dieting.innerHTML = dieting_list[index] + "家";
        this.cengting.innerHTML = cengzhang_list[index] + "家";
        this.zhangting.innerHTML = zhangting_list[index] + "家";
        this.closure_plate_htm.innerHTML = closure_plate[index] + "%";
        this.drawGaoBiaoCode(high_level[index]);

        if (this.float_window.offsetLeft != (60 + ev.layerX - ev.clientX)) {
            this.float_window.style =
                "position: absolute; z-index: 52; padding: 2px; width: 180px; line-height: 16px;\
             font-size: 12px; left: " +
                ((60 + ev.layerX - ev.clientX) + "") +
                "px; top: 30px; background-color: rgba(255, 255, 255, 0.9); color: rgb(0, 0, 0);\
              border: 1px solid rgb(0, 0, 0);"
        }

        if (ev.layerX < (ev.layerX - ev.clientX + 280) && this.float_window.offsetLeft == (60 + ev.layerX - ev.clientX)) {
            this.float_window.style =
                "position: absolute; z-index: 52; padding: 2px; width: 180px; line-height: 16px;\
             font-size: 12px; left: " +
                ((310 + ev.layerX - ev.clientX) + "") +
                "px; top: 30px; background-color: rgba(255, 255, 255, 0.9); color: rgb(0, 0, 0);\
              border: 1px solid rgb(0, 0, 0);"
        } else if (ev.layerX > (ev.layerX - ev.clientX + 280) && this.float_window.offsetLeft == (310 + ev.layerX - ev.clientX)) {
            this.float_window.style =
                "position: absolute; z-index: 52; padding: 2px; width: 180px; line-height: 16px;\
             font-size: 12px; left: " +
                ((60 + ev.layerX - ev.clientX) + "") +
                "px; top: 30px; background-color: rgba(255, 255, 255, 0.9); color: rgb(0, 0, 0);\
              border: 1px solid rgb(0, 0, 0);"
        }
    };


    LChart.prototype.monitorMouse = function () {
        that = this;
        var d = document.getElementById('canvas_layer');
        d.addEventListener('mouseenter', function () {
            that.float_window.style.display = "";
            that.indicator.style.display = "";
        });
        d.addEventListener('mousemove', function (ev) {
            ev = ev || window.event;
            that.updateFloatText(ev);
        });
        d.addEventListener('mouseleave', function (ev) {
            if (ev.relatedTarget != that.indicator) {
                that.float_window.style.display = "none";
                that.indicator.style.display = "none";
            }
        });
        d.addEventListener('mouseover', function (ev) {
            //ev = ev || window.event;
            //that.updateFloatText(ev);
        });
        d.addEventListener('mouseout', function (ev) {
            if (ev.relatedTarget != that.indicator) {
                that.float_window.style.display = "none";
                that.indicator.style.display = "none";
            }
        })
    };

    var lc = new LChart();

    send_parse_mess_from_db = function f() {
        var market_thermometer = new XMLHttpRequest();
        market_thermometer.overrideMimeType("application/json");
        market_thermometer.open("GET", "/api/market-temperature", true);
        // market_thermometer.open("GET", "a.json", true);
        market_thermometer.send(null);
        market_thermometer.onreadystatechange = function () {
            if (market_thermometer.readyState === 4 && market_thermometer.status === 200) {
                data = JSON.parse(market_thermometer.responseText);
                parse_data(data)
            } else if (market_thermometer.readyState === 4 && market_thermometer.status !== 200) {
                alert("无网络连接")
            }
        }
    };

    $(document).ready(function () {
        const Url = "api/market-temperature";
        $('#submit_btn').click(function () {
            var jsoStr = {
                "datetimeStart": $("#datetimeStart").children("input")[0].value,
                "datetimeEnd": $("#datetimeEnd").children("input")[0].value,
                "size": $("#size_1")[0].value
            };
            $.ajax({
                url: Url,
                type: "POST",
                data: jsoStr,
                success: function (result) {
                    console.log(result);
                    parse_data(result)
                },
                error: function (error) {
                    console.log(error)
                    parse_data(error)
                }
            })
        })

    });
    send_parse_mess_from_db();

    function parse_data(data) {
        if (data['api_call'] === 1) {
            cengzhang_earning_data = data['highlimit_crack_close_profit_ratio'];
            zhangting_earning_data = data['highlimit_close_profit_ratio'];
            gaobiao_data = data['gaobiao_count'];
            date_list_a = data['date'];
            cengzhang_list = data['reach_high_limit_count'];
            zhangting_list = data['high_limit_count'];
            diechao_5 = data['reach_minus5_count'];
            dieting_list = data['low_limit_with_volume_count'];

            zhangting_line = data['zhangting_line'];
            dieting_line = data['dieting_line'];
            shouyi_ratio_line = data['shouyi_ratio_line'];
            closure_plate = data['high_reach_high_ratio'];
            high_level = data['high_level_code'];

            lc.gaobiao_scale = data['gaobiao_scale'];
            lc.check_load_data();
        } else {
            alert(data['message'])
        }
    }

</script>
